package com.gt.deceive.controller.time;

import com.gt.deceive.entity.ZjTime;
import com.gt.deceive.service.time.TimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/t")
public class TimeController {
    @Autowired
    private TimeService timeService;

    @GetMapping("/add")
    public Long add(){
        ZjTime z = new ZjTime();
        z.setTime(System.currentTimeMillis());
        Long id = timeService.add(z);
        return id;
    }

    @GetMapping("/list")
    public List<ZjTime> list(){
        ZjTime z = new ZjTime();
        List<ZjTime> l = timeService.queryList(z);
        System.out.println(l);
        return l;
    }
}
